home *** CD-ROM | disk | FTP | other *** search
- #!/usr/free/bin/perl
- # Script to output CGI Information
- # From "Spinning the Web" by Andrew Ford, p 155.
-
- # Output to MIME headers and HTML document head
-
- print("Content-Type: text/html\n\n");
- print("<HEAD><TITLE>CGI Information Received</TITLE>\n");
- print("</HEAD><BODY><H1>CGI Information Received</H1>\n");
-
- # Output the values of environment variables
-
- print("<H2>Environment Variables</H2>\n<DL COMPACT>\n");
- foreach $var ("GATEWAY_INTERFACE", "REQUEST_METHOD",
- "CONTENT_TYPE", "CONTENT_LENGTH",
- "SCRIPT_NAME", "PATH_INFO",
- "PATH_TRANSLATED", "QUERY_STRING",
- "REMOTE_HOST", "REMOTE_ADDR",
- "REMOTE_USER", "REMOTE_IDENT",
- "SERVER_NAME", "SERVER_PORT",
- "SERVER_SOFTWARE", "SERVER_PROTOCOL",
- "AUTH_TYPE", "PATH", "HTTP_ACCEPT")
- {
- print("<DT><B>$var</B><DD>$ENV{$var}\n");
- }
- print("</DL>\n");
-
- #Output any command line arguments
-
- if ($#ARGV > 0) {
- print("<H2>Command Line Arguments</H2>\n");
- foreach $i (0 .. $#ARGV) {
- printf("ARGv[$i]: %s<BR>\n", $ARGV[$i]);
- }
- }
-
- # Output any data on the standard input stream
-
- if ($ENV{CONTENT_LENGTH} ne "") {
- read(STDIN, $content, $ENV{CONTENT_LENGTH});
- print("<H2>Data on Standard Input</H2>\n");
- print("<PRE>$content</PRE>\n");
- }
-
- print("</BODY>\n");
-
-